package net.cyndeline.components.objectProperties

import java.util.UUID
import net.cyndeline.entitySystem.Component

/**
 * Unique ID used by every object on the map. This component cannot be owned by
 * multiple entities at once. This ID is unique, even among multiple copies
 * of the same type of object.
 */
trait ObjectIdComponent extends Component {
  
  /** The ID of the object. */
  def id: UUID
}

class ObjectId extends ObjectIdComponent {
  var id = UUID.randomUUID()
  
  /**
   * Returns a component with a new id, since otherwise it would
   * have to be set manually whenever an object was copied.
   */
  override def copy = new ObjectId()
}